package cn.jiyun.teacher.controller;

import cn.jiyun.teacher.pojo.AdchannelVo;
import cn.jiyun.teacher.pojo.Teacher;
import cn.jiyun.teacher.pojo.TeacherDto;
import cn.jiyun.teacher.service.TeacherService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/teacher")
public class TeacherController {
    @Autowired
    private TeacherService teacherService;
    @RequestMapping("/findPage")
    public Page findPage(@RequestBody TeacherDto teacherDto){
        return teacherService.findPage(teacherDto);
    }
    @RequestMapping("/add")
    public AdchannelVo add(@RequestBody Teacher teacher){
        log.info("teacher:{}",teacher);
        return teacherService.add(teacher);
    }
    @RequestMapping("/{id}")
    public Teacher findById(@PathVariable("id")Integer id){
        return teacherService.findById(id);
    }
    @RequestMapping("/edit")
    public AdchannelVo edit(@RequestBody Teacher teacher){
        return teacherService.edit(teacher);
    }
}
